﻿using System;
using Sapit;

namespace ClientApplication
{
    public interface IFirstServiceProxyWindsor
    {
        [Sapit.Windsor.Attributes.Cache(CacheSeconds = 10)]
        string CallHelloWorld();

        [Sapit.Windsor.Attributes.CircuitBreaker(MaxConsecutiveFailures = 3, ShutOffPeriodSeconds = 20, BehaviorWhenShutOff = Sapit.Behavior.ReturnDefaultValue, ShutOffReturnValue = "The system is shut off.")]
        string CallUnstableHelloWorld();

        [Sapit.Windsor.Attributes.Cache(CacheSeconds = 10)]
        [Sapit.Windsor.Attributes.ResponseTimeThrottle(ThrottleThresholdMilliseconds = 250, SkipCallsWhenThrottling = 2, BehaviorWhenThrottling = Behavior.ThrowException, ThrottleReturnValue = "Service is slow")]
        string CallSlowHelloWorld();

        [Sapit.Windsor.Attributes.Timeout(TimeoutMilliseconds = 1000)]
        string CallSlowerHelloWorld();

        [Sapit.Windsor.Attributes.Retry(TimesToRetry = 0)]
        string CallFailingHelloWorld();
    }
}
